import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../views/home/login'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: './home' },
  {
    path: '/login',
    component: index,
    meta: {
      title: '英奇展商服务平台'
    }
  }, {
    path: '/home',
    component: () => import('../views/home/home.vue'),
    redirect: '/index',
    children: [
      {
        path: '/index', component: () => import('../views/home/index.vue'),
        meta: {
          title: '首页'
        }
      },
      {
        path: '/exhibitionId', component: () => import('../views/home/index.vue'),
        meta: {
          title: '首页'
        }
      },
      {
        path: '/user', component: () => import('../views/user/index.vue'),
        meta: {
          title: '个人中心',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/order', component: () => import('../views/order/index.vue'),
        meta: {
          title: '订单中心',
        }
      },
      {
        path: '/applyRecord', component: () => import('../views/apply/index.vue'),
        meta: {
          title: '报馆记录',
        }
      },
      {
        path: '/orderdetails', component: () => import('../views/order/deilts.vue'),
        meta: {
          title: '订单详情',
        }
      },
      {
        path: '/outfit', component: () => import('../views/outfit/index.vue'),
        meta: {
          title: '特装'
        }
      },
      {
        path: '/examine', component: () => import('../views/outfit/examine.vue'),
        meta: {
          title: '特装审图'
        }
      },
      {
        path: '/outdownfile', component: () => import('../views/outfit/filldown.vue'),
        meta: {
          title: '资料下载'
        }
      },
      {
        path: '/lease', component: () => import('../views/outfit/lease.vue'),
        meta: {
          title: '租赁服务',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/detailed', component: () => import('../components/outfit/lease/detailed.vue'),
        meta: {
          title: '结算清单',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/liquidation', component: () => import('../components/outfit/lease/liquidation.vue'),
        meta: {
          title: '核对',
        }
      },
      {
        path: '/payment', component: () => import('../components/outfit/lease/payment.vue'),
        meta: {
          title: '支付',
        }
      },
      {
        path: '/booth', component: () => import('../views/outfit/booth.vue'),
        meta: {
          title: '会费缴纳',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/fixedFee', component: () => import('../components/outfit/booth/fixedFee.vue'),
        meta: {
          title: '费用列表',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/fixedfeedetailed', component: () => import('../components/outfit/booth/detailed.vue'),
        meta: {
          title: '结算清单',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/feeOfflinePayment', component: () => import('../components/outfit/booth/feeOfflinePayment.vue'),
        meta: {
          title: '支付',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/invoiceIndex', component: () => import('../views/outfit/invoiceIndex.vue'),
        meta: {
          title: '发票申请',
        }
      },
      {
        path: '/foregift', component: () => import('../views/outfit/foregift.vue'),
        meta: {
          title: '押金退还',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/exhibition', component: () => import('../views/exhibition/index.vue'),
        meta: {
          title: '特装',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/fasciaList', component: () => import('../views/exhibition/fasciaList.vue'),
        meta: {
          title: '楣板申请',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/bookletList', component: () => import('../views/exhibition/bookletList.vue'),
        meta: {
          title: '提交会刊',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/tzbooth', component: () => import('../views/exhibition/booth.vue'),
        meta: {
          title: '会费缴纳',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/tzlease', component: () => import('../views/exhibition/lease.vue'),
        meta: {
          title: '租赁',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/drawingsBoothConfirm', component: () => import('../views/outfit/drawing.vue'),
        meta: {
          title: '展位信息确认',
        }
      },
      {
        path: '/drawingadd', component: () => import('../views/outfit/drawingadd.vue'),
        meta: {
          title: '搭建展位',
          keepAlive: false,
          isBack: false
        }
      },
      {
        path: '/editApply', component: () => import('../views/outfit/editApply.vue'),
        meta: {
          title: '编辑申请',
          keepAlive: false,
          isBack: false
        }
      },
      {
        path: '/fygl', component: () => import('../views/outfit/fygl.vue'),
        meta: {
          title: '防疫管理',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/czys', component: () => import('../views/outfit/czys.vue'),
        meta: {
          title: '撤展验收',
          keepAlive: true,
          isBack: false
        }
      },
      {
        path: '/drawingdetail', component: () => import('../components/outfit/drawing/drawingdetail.vue'),
        meta: {
          title: '详情',
          keepAlive: false,
          isBack: false
        }
      },
      {
        path: '/toUpdatedetile', component: () => import('../components/outfit/drawing/updatadetil.vue'),
        meta: {
          title: '图片查看',
        }
      },
    ]
  },
]

const router = new VueRouter({
  mode: "history",
  routes,
  scrollBehavior(to, from, savedPosition) {
    console.log(savedPosition)
    if (savedPosition) {
      return savedPosition
    } else {
      return {
        x: 0,
        y: 0
      }
    }
  }
})

export default router
